package com.wxy.demo.lombok;

import cn.hutool.json.JSONUtil;

/**
 * <p>
 *
 * </p>
 *
 * @author e-Xiaoyuan.Wang
 * @since 2022/6/27 10:03
 */
public class User2 {
    private Boolean male;
    private Boolean isMale;

    /**
     * =============== 快捷键生成，无法生成isMale =================
     */
    public Boolean getMale() {
        return male;
    }

    public void setMale(Boolean male) {
        this.male = male;
    }

    /**
     * ============== 自定义 ===================
     */
    public Boolean getIsMale() {
        return isMale;
    }

    public void setIsMale(Boolean isMale) {
        this.isMale = isMale;
    }

    @Override
    public String toString() {
        return "User2{" +
                "male=" + male +
                ", isMale=" + isMale +
                '}';
    }

    public static void main(String[] args) {
        User2 user2 = new User2();
        user2.setIsMale(true);
        user2.setMale(false);
        String json = JSONUtil.toJsonStr(user2);
        System.out.println(json);
        User2 bean = JSONUtil.toBean(json, User2.class);
        System.out.println(bean);
    }

}
